package com.xdf.xzymanagementsystem.util;


/**
 * 状态码统一为4位长度：
 * 1xxx：服务器接收到信息，但是出现异常导致请求不成功
 * 2xxx：请求成功
 * 3xxx：请求重定向之类
 * 4xxx：客户端错误，41xx表示参数异常，42xx表示账户以及密码异常
 * 5xxx：服务器内部错误
 * 6xxx：业务逻辑不完整或者冲突
 */
public enum ResultCode {

    OK(1, ""),
    ID_EXIST(1001, "ID重复"),
    PARAM_IS_BLANK(4101, "参数为空"),
    PARAM_LACK(4102, "参数个数不对"),
    USER_NOT_EXIST(4201, "用户不存在"),
    PASSWORD_ERROR(4202, "密码错误"),
    AUTHENTICATION_ERROR(4203, "账号或密码错误"),
    UNDEFINED_ERROR(9999, "未定义的错误");


    private Integer code;
    private String msg;
    private boolean showMsg;
    private boolean refreshUI;

    ResultCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
        this.refreshUI = true;
        this.showMsg = true;
    }

    ResultCode(Integer code, String msg,boolean refreshUI,boolean showMsg) {
        this.code = code;
        this.msg = msg;
        this.refreshUI = refreshUI;
        this.showMsg = showMsg;
    }

    public Integer getCode() {
        return this.code;
    }

    public String getMsg() {
        return this.msg;
    }
}

